package com.oocl.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.oocl.exception.MyException;
import com.oocl.pojo.Favc;
import com.oocl.service.FavcService;
import com.oocl.service.impl.FavcServiceFactory;
import com.oocl.service.impl.ServiceFactory;

/*
 * 跳转并初始化注册界面
 * 
 * */
public class InitRegisterServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
	
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		 try {
			FavcServiceFactory facytory = (FavcServiceFactory) ServiceFactory.getServiceFactory("favc");
			FavcService fSer = facytory.getService();
			List<Favc> list = fSer.getList();
			System.out.println(list.size());
			request.setAttribute("list", list);
			request.getRequestDispatcher("register.jsp").forward(request, response);
		} catch (MyException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

}
